home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 22 / CU Amiga Magazine's Super CD-ROM 22 (1998)(EMAP Images)(GB)[!][issue 1998-05].iso / PowerPC / Programming / PPCSmallEiffel / lib_se / proc_call_n.e < prev    next >
Encoding:
Text File  |  1998-01-16  |  2.8 KB  |  114 lines

  1. --          This file is part of SmallEiffel The GNU Eiffel Compiler.
  2. --          Copyright (C) 1994-98 LORIA - UHP - CRIN - INRIA - FRANCE
  3. --            Dominique COLNET and Suzanne COLLIN - colnet@loria.fr 
  4. --                       http://www.loria.fr/SmallEiffel
  5. -- SmallEiffel is  free  software;  you can  redistribute it and/or modify it 
  6. -- under the terms of the GNU General Public License as published by the Free
  7. -- Software  Foundation;  either  version  2, or (at your option)  any  later 
  8. -- version. SmallEiffel is distributed in the hope that it will be useful,but
  9. -- WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
  10. -- or  FITNESS FOR A PARTICULAR PURPOSE.   See the GNU General Public License 
  11. -- for  more  details.  You  should  have  received a copy of the GNU General 
  12. -- Public  License  along  with  SmallEiffel;  see the file COPYING.  If not,
  13. -- write to the  Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  14. -- Boston, MA 02111-1307, USA.
  15. --
  16. class PROC_CALL_N
  17.    --
  18.    -- For a procedure call with more than one argument. 
  19.    --  
  20.  
  21. inherit PROC_CALL;
  22.    
  23. creation make
  24.    
  25. feature 
  26.    
  27.    arguments: EFFECTIVE_ARG_LIST;
  28.    
  29.    make(t: like target; sn: like feature_name; a: like arguments) is
  30.       require
  31.      t /= Void;
  32.      sn /= Void;
  33.      a.count > 1
  34.       do
  35.      target := t;
  36.      feature_name := sn;
  37.      arguments := a;
  38.       end;
  39.  
  40. feature
  41.    
  42.    to_runnable(rc: like run_compound): like Current is
  43.       local
  44.      a: like arguments;
  45.       do
  46.      if run_compound = Void then
  47.         to_runnable_0(rc);
  48.         if nb_errors = 0 then
  49.            a := arguments.to_runnable(current_type);
  50.            if a = Void then
  51.           error(arguments.start_position,fz_bad_arguments)
  52.            else
  53.           arguments := a;
  54.            end;
  55.         end;
  56.         if nb_errors = 0 then
  57.            arguments.match_with(run_feature); 
  58.         end;
  59.         if nb_errors = 0 then
  60.            Result := Current;
  61.         end;
  62.      else
  63.         !!Result.make(target,feature_name,arguments);
  64.         Result := Result.to_runnable(rc);
  65.      end;
  66.       end;
  67.    
  68.    arg_count: INTEGER is 
  69.       do
  70.      Result := arguments.count;
  71.       end;
  72.    
  73.    pretty_print is
  74.       do
  75.      target.print_as_target;
  76.      fmt.put_string(feature_name.to_string);
  77.      fmt.level_incr;
  78.      arguments.pretty_print;
  79.      fmt.level_decr;
  80.      if fmt.semi_colon_flag then
  81.         fmt.put_character(';');
  82.      end;
  83.       end;
  84.    
  85.    compile_to_jvm is
  86.       do
  87.      call_proc_call_c2jvm;
  88.       end;
  89.    
  90. feature {CREATION_CALL}
  91.  
  92.    make_runnable(rc: like run_compound; 
  93.          w: like target; a: like arguments;
  94.          rf: RUN_FEATURE): like Current is
  95.       do
  96.      if run_compound = Void then
  97.         Result := Current;
  98.         Result.make(w,feature_name,a);
  99.         run_compound := rc;
  100.         run_feature := rf;
  101.      else
  102.         !!Result.make(w,feature_name,a);
  103.         Result.set_run_compound(rc);
  104.         Result.set_run_feature(rf);
  105.      end;
  106.       end;
  107.  
  108. invariant
  109.    
  110.    arguments.count > 1
  111.    
  112. end -- PROC_CALL_N
  113.  
  114.